package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;
import com.eastfair.projectcore.enumeration.DataIsolationSystemSceneEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * The enum Service provider type enum.
 *
 * @author dqq
 * @date 2022 /7/15
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ServiceProviderTypeEnum", description = "服务商类型 #{BUILD_SERVICE_PROVIDER:搭建服务商;MAIN_TRANSPORT_SERVICE_PROVIDER:主运服务商;HOME_SERVICE_PROVIDER:主场服务商;MATCHING_SERVICE_PROVIDER:配套服务商-枚举")
public enum ServiceProviderTypeEnum implements BaseEnum {

    /**
     * 搭建服务商.
     */
    BUILD_SERVICE_PROVIDER("搭建服务商"),

    /**
     * 主运服务商.
     */
    MAIN_TRANSPORT_SERVICE_PROVIDER("主运服务商"),

    /**
     * 主场服务商.
     */
    HOME_SERVICE_PROVIDER("主场服务商"),

    /**
     * 配套服务商.
     */
    MATCHING_SERVICE_PROVIDER("配套服务商"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;

    public static ServiceProviderTypeEnum match(String val, ServiceProviderTypeEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ServiceProviderTypeEnum get(String val) {
        return match(val, null);
    }

    @Override
    public String getCode() {
        return this.name();
    }

    public boolean eq(ServiceProviderTypeEnum val) {
        return val != null && eq(val.name());
    }

}